import { Module } from 'Vuex'
import http from '@/http/index'
import { api } from '@/http/api'
import GlobalDataProps from '../types'
import { Introduce } from './types'

const system: Module<Introduce, GlobalDataProps> = {
  namespaced: true,
  state: {},
  mutations: {},
  actions: {
    // 查询货主-承运商-司机简介
    handleTransportBillCommentPersonSynopsis: async ({ commit }, params: any): Promise<any> => {
      let finalResult = ''
      try {
        const result = await http({
          url: api.transportBillCommentPersonSynopsis,
          method: 'get',
          params
        })
        finalResult = result
      } catch (e) {
        console.log(`ERROR FROM handleTransportBillCommentPersonSynopsis: ${e}`)
      }
      return finalResult
    },
    // 查询评价列表
    handleTransportBillCommentPage: async ({ commit }, params: any): Promise<any> => {
      let finalResult = ''
      try {
        const result = await http({
          url: api.transportBillCommentPage,
          method: 'get',
          params
        })
        finalResult = result
      } catch (e) {
        console.log(`ERROR FROM handleTransportBillCommentPage: ${e}`)
      }
      return finalResult
    }
  }
}

export default system
